The present invention relates to a memory administrating method for conducting dynamically acquisition and release of a memory region, particularly to a technique to efficiently share a memory for a plurality of different usages.
To ensure effective use of a memory resource, a computer apparatus adopts a dynamic memory administration in which each processing acquires a region of a required size whenever required, and releases the region after having used the region.
In such a memory administration, there are great differences in the size of the region to be acquired, and the time to release the region. If the process of acquisition and release is repeated, fragmented unused regions (vacant region) will occur and the memory region will be divided into discontinuous fragmented-regions. Thus, a continuous large-sized vacant region cannot be ensured, although a sufficient amount of regions is available as a total region.
In the conventional method, when a region 301 having been used is to be released, a check is made to see if there is any unused region before and after the region 301 to be released, as shown in FIG. 9. If there are unused neighboring regions 302 and 303, the region 301 to be released and the unused regions 302 and 303 are united into one unused region 304 (e.g., Unexamined Japanese Patent Publication No. H5-12099).
When a memory is shared among a plurality of usages having great differences in the region size to be acquired and the time of use before release, there will be a greater possibility to cause fragmented portions and a large-sized continuous region cannot be obtained. For example, the system memory may be shared for use as a region for image processing and a region for normal data processing by software. Since there are great differences in the required region size and time of use before release between the region for image and that for software, the problem of fragmentation will be more serious. Thus, the occurrence of fragmented region cannot be avoided by the conventional memory administrating method of combining unused neighboring regions at the time of releasing.
When hardware is used for the aforementioned image processing by sharing a system memory, the memory region must be administrated on the boundary for the sake of processing on the part of hardware in some cases. In such cases, uniform administration of the system memory on the boundary will result in useless acquisition of the region for software. Thus, effective use of the memory cannot be achieved. Similarly, when the memory is shared among a plurality of pieces of hardware having different fixed length sizes on the boundary, uniform administration of the memory based on the fixed length conforming to any one piece of the hardware will cause the memory to be wasted, when acquiring the region for other pieces of hardware.